package com.bootdo.app.controller;

import com.bootdo.app.common.msg.Response;
import com.bootdo.app.service.UserCashOutService;
import com.bootdo.app.vo.miniprogram.UserCashOutVo;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @auther: Along
 * @description: 用户提现控制类
 * @Date: created in 2020/12/15 13:58
 */
@RestController
@RequestMapping(value = "/app/user_balance")
public class UserCashOutController {

    @Autowired
    private UserCashOutService userCashOutService;

    /**
     * 提现
     */
    @PostMapping(value = "/cash_out")
    public Response cashOut(@RequestParam("amount")String amount){
        userCashOutService.cashOut(amount);
        return Response.success();
    }


    /**
     * 提现列表查询
     */
    @PostMapping(value = "/cash_out_list")
    public Response cashOutList(){
        // todo 此处没有做分页
        List<UserCashOutVo> cashOutList = userCashOutService.getCashOutList();
        return Response.success(cashOutList);
    }
}
